﻿using SmartMotion.AllPages;
using SmartMotion.AllPages.Debug;
using SmartMotion.AllPages.DockPanels;
using SmartMotion.AllPages.SysConfig;
using SmartMotion.Core;
using Sunny.UI;
using System;
using System.Windows.Forms;
using SmartMotion.Properties;
using Unity;

namespace SmartMotion
{
    internal static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var container = UnityIoc.Ins.Container;
            container.RegisterType<UIPage, FrmProductMgr>("FrmProductMgr");
            container.RegisterType<UIPage, FrmFlowEdit>("FrmFlowEdit");
            container.RegisterType<UIPage, FrmStationDebug>("FrmStationDebug");
            container.RegisterType<UIPage, FrmIODebug>("FrmIODebug");
            container.RegisterType<UIPage, FrmMotionConfig>("FrmMotionConfig");
            container.RegisterType<UIPage, FrmIOConfig>("FrmIOConfig");
            container.RegisterType<UIPage, FrmStationConfig>("FrmStationConfig");
            container.RegisterType<UIPage, FrmDeviceConfig>("FrmDeviceConfig");
            container.RegisterSingleton<FrmToolBox>();
            container.RegisterSingleton<FrmSolutionMgr>();
            container.RegisterSingleton<FrmProperty>();
            container.RegisterSingleton<FrmDebug>();
            container.RegisterSingleton<FrmParms>();
            container.RegisterSingleton<FrmVar>();
            container.RegisterType<FrmFLowChartEdit>();
            FlowsMgr.Ins.LoadFLows();
            ProductMgr.Ins.Open(Settings.Default.ProductFilePath);
            IOMgr.Ins.Load();
            MotionMgr.Ins.Load();

            StationsMgr.Ins.Load();

            PointsMgr.Ins.Open();
            Application.Run(new FrmMain());
        }
    }
}